package com.gmail.blackdog1987.onedollar.entity;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * Created by dongguochao on 12/7/15.
 */
@Entity
@Table(name = "t_prizes", schema = "", catalog = "onedollar")
public class TPrizesEntity {
    private int id;
    private String prizesName;
    private String prizesImg;
    private Integer prizesTotal;
    private Integer prizesNum;
    private BigDecimal chance;
    private Timestamp startTime;
    private Timestamp endTime;
    private Integer status;
    private Integer peerStart;
    private Integer peerEnd;

    @Id
    @GeneratedValue
    @Column(name = "id", nullable = false, insertable = false, updatable = true)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "prizes_name", nullable = true, insertable = true, updatable = true, length = 50)
    public String getPrizesName() {
        return prizesName;
    }

    public void setPrizesName(String prizesName) {
        this.prizesName = prizesName;
    }

    @Basic
    @Column(name = "prizes_img", nullable = true, insertable = true, updatable = true, length = 255)
    public String getPrizesImg() {
        return prizesImg;
    }

    public void setPrizesImg(String prizesImg) {
        this.prizesImg = prizesImg;
    }

    @Basic
    @Column(name = "prizes_total", nullable = true, insertable = true, updatable = true)
    public Integer getPrizesTotal() {
        return prizesTotal;
    }

    public void setPrizesTotal(Integer prizesTotal) {
        this.prizesTotal = prizesTotal;
    }

    @Basic
    @Column(name = "prizes_num", nullable = true, insertable = true, updatable = true)
    public Integer getPrizesNum() {
        return prizesNum;
    }

    public void setPrizesNum(Integer prizesNum) {
        this.prizesNum = prizesNum;
    }

    @Basic
    @Column(name = "chance", nullable = true, insertable = true, updatable = true, precision = 4)
    public BigDecimal getChance() {
        return chance;
    }

    public void setChance(BigDecimal chance) {
        this.chance = chance;
    }

    @Basic
    @Column(name = "start_time", nullable = true, insertable = true, updatable = true)
    public Timestamp getStartTime() {
        return startTime;
    }

    public void setStartTime(Timestamp startTime) {
        this.startTime = startTime;
    }

    @Basic
    @Column(name = "end_time", nullable = true, insertable = true, updatable = true)
    public Timestamp getEndTime() {
        return endTime;
    }

    public void setEndTime(Timestamp endTime) {
        this.endTime = endTime;
    }

    @Basic
    @Column(name = "status", nullable = true, insertable = true, updatable = true)
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "peer_start", nullable = true, insertable = true, updatable = true)
    public Integer getPeerStart() {
        return peerStart;
    }

    public void setPeerStart(Integer peerStart) {
        this.peerStart = peerStart;
    }

    @Basic
    @Column(name = "peer_end", nullable = true, insertable = true, updatable = true)
    public Integer getPeerEnd() {
        return peerEnd;
    }

    public void setPeerEnd(Integer peerEnd) {
        this.peerEnd = peerEnd;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TPrizesEntity that = (TPrizesEntity) o;

        if (id != that.id) return false;
        if (prizesName != null ? !prizesName.equals(that.prizesName) : that.prizesName != null) return false;
        if (prizesImg != null ? !prizesImg.equals(that.prizesImg) : that.prizesImg != null) return false;
        if (prizesTotal != null ? !prizesTotal.equals(that.prizesTotal) : that.prizesTotal != null) return false;
        if (prizesNum != null ? !prizesNum.equals(that.prizesNum) : that.prizesNum != null) return false;
        if (chance != null ? !chance.equals(that.chance) : that.chance != null) return false;
        if (startTime != null ? !startTime.equals(that.startTime) : that.startTime != null) return false;
        if (endTime != null ? !endTime.equals(that.endTime) : that.endTime != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;
        if (peerStart != null ? !peerStart.equals(that.peerStart) : that.peerStart != null) return false;
        if (peerEnd != null ? !peerEnd.equals(that.peerEnd) : that.peerEnd != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (prizesName != null ? prizesName.hashCode() : 0);
        result = 31 * result + (prizesImg != null ? prizesImg.hashCode() : 0);
        result = 31 * result + (prizesTotal != null ? prizesTotal.hashCode() : 0);
        result = 31 * result + (prizesNum != null ? prizesNum.hashCode() : 0);
        result = 31 * result + (chance != null ? chance.hashCode() : 0);
        result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
        result = 31 * result + (endTime != null ? endTime.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (peerStart != null ? peerStart.hashCode() : 0);
        result = 31 * result + (peerEnd != null ? peerEnd.hashCode() : 0);
        return result;
    }

    private BigDecimal price;

    @Basic
    @Column(name = "price", nullable = true, insertable = true, updatable = true, precision = 2)
    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }
}
